<include file="Public/head"/>
<css href="__PUBLIC__/qwadmin/css/bootstrap-datetimepicker.min.css"/>
<body class="no-skin">
<include file="Public/header"/>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <include file="Public/sidebar"/>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs"/>
            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set"/>

                <!-- /section:settings.box -->
                <div class="row">
                    <div>
                         <form class="form-inline" action="" method="get">
                                <label class="inline">请选择时间段</label>
                                <input type="text" class="form-control datetimeStart" readonly  value="{$dateS}"/>
                                &nbsp;-&nbsp;
                                <input type="text" class="form-control datetimeEnd" readonly  value="{$dateE}"/>
                                
                                <label class="inline">请选择支付类型</label>
                                <select name="pay_type" class="pay_type" class="form-control">
                                    <option value="0" <if condition=" I('get.pay_type') eq 0 ">selected="selected"</if> >全部</option>
                                    <option value="1" <if condition=" I('get.pay_type') eq 1 ">selected="selected"</if>>线上</option>
                                    <option value="2" <if condition=" I('get.pay_type') eq 2 ">selected="selected"</if>>线下</option>
                                </select>
                                <button type="button" onclick="sou()" class="btn btn-purple btn-sm">
                                    <span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
                                    			搜索
                                </button>
                                <button type="button"  class="btn btn-purple btn-sm" onclick='pri()'>
                                    <span class="ace-icon fa fa-print icon-on-right bigger-110"></span>
                                   		 打印全部
                                </button>
                                <button type="button"  class="btn btn-purple btn-sm pri" onclick='preview(1)'>
                                    <span class="ace-icon fa fa-print icon-on-right bigger-110" ></span>
                                   		 打印本页
                                </button>
                          </form>
                    </div>
                         
                    <div class="space-4"></div>
                     <!--startprint1-->
                     <div class="cf">
                           <h2 class=" text-center">幼儿园进账汇总</h2>
                           <h5>幼儿园名称：{$data[0]['m_name']}</h5>
                   		<h5>时&nbsp;&nbsp;&nbsp;&nbsp;间&nbsp;&nbsp;&nbsp;&nbsp;段：{$dateS}&nbsp;至&nbsp;{$dateE}</h5>
                      </div>
                      
                     <div class="space-4"></div>
                      <table class="table table-striped table-bordered" >
                            <thead>
	                            <tr>
	                                <th class="center">财务分类</th>
	                                <th class="center">总金额</th>
	                            </tr>
                            </thead>
                            <tbody>
                                 <tr>
                                 <?php if(empty($allmoney)){ ?>
                                 	<td class="center" colspan='2' style='color:red;'>改时间段没有入账记录！</td>
                                 <?php }else{ ?>
                                    <td class="center"> {$name_type}财务汇总</td>
 					 				<td class="center">￥{$allmoney}</td>
 					 				<?php } ?>				
                                </tr>
                            </tbody>
                        </table>
                      <div class="space-4"></div>
                     <div>
                     		<h2 class=" text-center"> 幼儿园进账详情 </h2>
                     </div>
                     
                    <div class="space-4"></div>
                       <table class="table table-striped table-bordered">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>用户名称</th>
                                <th>报名人名称</th>
                                <th>报名学校</th>
                                <th>报名班级</th>
                                <th>报名金额</th>
                                <th>是否支付</th>
                                <th>支付类型</th>
                                <th>报名时间</th>
                            </tr>
                            </thead>
                            <tbody>

                            <?php if($data){
                                foreach($data as $k=>$val){ ?>
                                 <tr>

                                     <td><?php echo $k+1?></td>
                                     <td><?php echo $val['u_name']?></td>
                                     <td><?php echo $val['b_name']?></td>
                                     <td><?php echo $val['m_name']?></td>
                                     <td><?php echo $val['c_name']?></td>
                                     <td><?php echo $val['price']?></td>
                                     <td><if condition=" $val['is_pay'] eq 1 ">已支付<else/>未支付</if></td>
                                     <td><if condition=" $val['pay_type'] eq 1 ">线上支付<else/>线下支付</if></td>
                                     <td><?php echo $val['add_time'];?></td>
                                </tr>
                            <?php }
								}else{echo "<tr align='center'><td colspan='9' style='color:red;'>该时间段没有入账记录！</td></tr>";}?>
                            </tbody>
                        </table>
                    {$page}
                     <!--endprint1-->
                    <!-- PAGE CONTENT ENDS -->
                </div><!-- /.col -->
            </div><!-- /.row -->
        </div><!-- /.page-content -->
    </div>
</div><!-- /.main-content -->
<include file="Public/footer"/>
<script src="__PUBLIC__/qwadmin/js/jquery-1.9.1.min.js"></script>
<script src="__PUBLIC__/qwadmin/js/bootstrap-datetimepicker.js"></script>
<script src="__PUBLIC__/qwadmin/js/bootstrap-datetimepicker.zh-CN.js"></script>
<include file="Public/footerjs"/>
<!-- inline scripts related to this page -->
<script type="text/javascript">
/* 打印全部 */
function pri(){
	 var dateS = $('.datetimeStart').val();
	 var dateE = $('.datetimeEnd').val();
	 var pay_type = $('.pay_type').val();
	 var param = '/type/2';
	 if(dateS){
	        param += '/dateS/'+dateS;
	        if(dateE ==''){
	        	alert('请选择结束时间');
	        	return false;
	        }else{
	        	param += '/dateE/'+dateE;
	        }
	    }
	 if(pay_type){
		 param +='/pay_type/'+pay_type;
	 }
	 
    location.href="__APP__/Admin/Financial/index"+param+".html";
}
/* 打印当前页 */
function preview(oper) {
	if (oper < 10) {
	bdhtml = window.document.body.innerHTML;//获取当前页的html代码 
	sprnstr = "<!--startprint" + oper + "-->";//设置打印开始区域 
	eprnstr = "<!--endprint" + oper + "-->";//设置打印结束区域 
	prnhtml = bdhtml.substring(bdhtml.indexOf(sprnstr) + 18); //从开始代码向后取html 
	prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr));//从结束代码向前取html 
	window.document.body.innerHTML = prnhtml; 
	window.print(); 
	window.document.body.innerHTML = bdhtml; 
	} else { 
	window.print(); 
	}
}

$(".datetimeStart").datetimepicker({
    format: 'yyyy-mm-dd',
    minView:'month',
    language: 'zh-CN',
    autoclose:true
}).on("click",function(){
    $(".datetimeStart").datetimepicker("setEndDate",$(".datetimeEnd").val())
});

$(".datetimeEnd").datetimepicker({
    format: 'yyyy-mm-dd',
    minView:'month',
    language: 'zh-CN',
    autoclose:true
}).on("click",function(){
    $(".datetimeEnd").datetimepicker("setStartDate",$(".datetimeStart").val())
});

function sou(){
	 var dateS = $('.datetimeStart').val();
	 var dateE = $('.datetimeEnd').val();
	 var pay_type = $('.pay_type').val();
	 var param = '';
	 if(dateS){
	        param += '/dateS/'+dateS;
	        if(dateE ==''){
	        	alert('请选择结束时间');
	        	return false;
	        }else{
	        	param += '/dateE/'+dateE;
	        }
	    }
	 if(pay_type){
		 param +='/pay_type/'+pay_type;
	 }
	 
    location.href="__APP__/Admin/Financial/index"+param+".html";
}
</script>
</body>
</html>
